package com.power.controller;

import com.alibaba.fastjson.JSON;
import com.power.ov.ResultDataTable;
import com.power.service.impl.InspeServiceimpl;
import com.power.service.inspeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: 李辽
 * Date: 2020/10/09 10:52
 * Description:查询所有的巡检信息
 * Version: V1.0
 */
@WebServlet("/QueryListInspection.do")
public class QueryListInspection extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int page = Integer.parseInt(request.getParameter("page"));//获取当前页码数
        int limit = Integer.parseInt(request.getParameter("limit"));//获取当前页展示数据条数
        response.setContentType("application/json;charset=utf-8");
        ResultDataTable  resultDataTable  = new ResultDataTable();
        inspeService inspeService = new InspeServiceimpl();

        try {
            resultDataTable = inspeService.QueryListInspection(page,limit);

        } catch (SQLException e) {
            e.printStackTrace();
        }

        response.getWriter().write(JSON.toJSONString(resultDataTable));
        response.getWriter().flush();
        response.getWriter().close();

    }
}






















